// import type { ResultModel, LoginEmp } from '@/api/model/model'

// // 登录接口
// export const loginApi = (data: LoginEmp) =>
//   request.post<any, ResultModel>('/login', data)


import request from '@/utils/request';
import type {
  BaseResponse,
  LoginParams,
  LoginResponseData,
  SendSmsParams
} from './model/model';

// 登录
export const login = (params: LoginParams) =>
  request.post<BaseResponse<LoginResponseData>>('/user/login', params, {
    headers: { 'Content-Type': 'multipart/form-data' }
  });

// 发送短信验证码
export const sendSms = (params: SendSmsParams) =>
  request.post<BaseResponse<null>>('/sms/sendCode', params, {
    headers: { 'Content-Type': 'multipart/form-data' }
  });

// 验证短信验证码
export const verifySmsCode = (params: { mobile: string; code: string }) =>
  request.post<BaseResponse<null>>('/sms/verifyCode', params, {
    headers: { 'Content-Type': 'multipart/form-data' }
  });

// 管理端登录
export const adminLogin = (params: LoginParams) =>
  request.post<BaseResponse<LoginResponseData>>('/login/adminLogin', params, {
    headers: { 'Content-Type': 'multipart/form-data' }
  });

// 个人端登录
export const clientLogin = (params: LoginParams) =>
  request.post<BaseResponse<LoginResponseData>>('/login/clientLogin', params, {
    headers: { 'Content-Type': 'multipart/form-data' }
  });

// 退出登录
export const logout = (token: string) =>
  request.post<BaseResponse<null>>('/login/logout', null, {
    headers: { token }
  });
